<?php

/** libraries
 * http://docs.joomla.org/JToolBarHelper
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// import Joomla view library
jimport('joomla.application.component.view');

class bgViewbg extends JView
{
	// Overwriting JView display method
	function display($tpl = null) 
	{
	   
       $model = $this->getModel();
       
       switch(JRequest::getVar('task')){
            case 'error':
                JToolBarHelper::title( '画像管理マスタ', 'msbanner.png' );
                JToolBarHelper::save('save','登録');
            	JToolBarHelper::cancel('cancel', 'キャンセル');
                $this->setLayout('add');
            	break;
            case 'add':
            	//JToolBarHelper::title( 'THEM HINH ANH', 'user.png' );
                JToolBarHelper::title( '画像追加', 'msbanner.png' );
                JToolBarHelper::save('save','登録');
            	JToolBarHelper::cancel('cancel', 'キャンセル');
                $this->setLayout('add');
            	break;
            case 'edit':
                $cid = JRequest::getVar('cid');
                $cid = is_array($cid) ? $cid[0] : $cid;
                
                if($cid){
                    $this->row = $model->load($cid);
                }
                else{
                    die("データは見つかりませんでした");
                }
                JToolBarHelper::title( '画像編集', 'msbanner.png' );
                JToolBarHelper::save('save','登録');
                JToolBarHelper::cancel('cancel', 'キャンセル');
                $this->setLayout('edit');
                break;
            	    
            default :
                $this->list['filter_search'] = &JRequest::getVar('filter_search');
                
                $this->rows =& $model->getAll($this->list); 
                $this->pagination =& $this->get('Pagination');
                
            	//JToolBarHelper::title( 'QUAN LY MASTER HINH ANH', 'user.png' );
                JToolBarHelper::title( '画像管理マスタ', 'msbanner.png' );
                JToolBarHelper::addNew('add','作成');
                JToolBarHelper::editList('edit', '編集');
            	JToolBarHelper::deleteList('', 'remove','削除');
                
                $this->setLayout('default');
		}
        
		parent::display();
	}
}




